<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #xdd{
            display: inline-block;
            width: 200px;
            height: 200px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div id = "xdd" >
        <script>
            let div = document.getElementById("xdd")
            // div.onclock=function(){
            //     this.style.backgroundColor="green";
            // }


            div.onclick = function(){
                window.setTimeout(() =>{
                    this.style.backgroundColor='green';
                },1000)
            }
        </script>
    </div>
</body>
</html>